package org.koyad.portal.tags.html;

import org.koyad.portal.annotations.TagCordinates;
import org.koyad.portal.annotations.TagType;
import org.koyad.portal.constants.FrameworkConstants;
import org.koyad.portal.context.PistonContext;
import org.koyad.portal.tags.Attribute;
import org.koyad.portal.tags.AbstractTag;
import org.koyad.portal.utils.LogUtils;

@TagCordinates (
	uri = FrameworkConstants.HTML5_NAMESPACE,
	localName = "img",
	type = TagType.NOBODY
)
public class ImgTag extends AbstractTag {

	private static final LogUtils LOGGER = LogUtils.getLogger(ImgTag.class);

	@SuppressWarnings("unchecked")
	@Override
	public void postInit() {
		
		for(Attribute att : _atts) {
			if(att.getName().equals("src")) {
				att.setValue(PistonContext.getContext().getRequest().getContextPath() + att.getValue());
				break;
			}
		}
	}
	
}
